<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/


Route::get('/',['as'=>'Home','uses'=> 'HomeController@index']);
Route::get('login','HomeController@login');

Route::group(['prefix' => 'api'],function() {
    /** 获取token */
    Route::get('get-csrf-token', ['as' => 'Api.General.GetCsrfToken', 'uses' => 'Api\GeneralController@getCsrfToken']);

    /** 用户注册认证接口 */
    Route::post('auth/get-verify-code-by-phone-for-signup', ['as' => 'Api.Auth.getVerifyCodeByPhoneForSignUp', 'uses' => 'Api\AuthController@getVerifyCodeByPhoneForSignUp']);
    Route::post('auth/get-verify-code-by-phone', ['as' => 'Api.Auth.getVerifyCodeByPhone', 'uses' => 'Api\AuthController@getVerifyCodeByPhone']);
    Route::post('auth/get-verify-code-by-email', ['as' => 'Api.Auth.getVerifyCodeByEmail', 'uses' => 'Api\AuthController@getVerifyCodeByEmail']);
    Route::post('auth/check-verify-code-for-phone-to-authorize-session', ['as' => 'Api.Auth.checkVerifyCodeForPhoneToAuthorizeSession', 'uses' => 'Api\AuthController@checkVerifyCodeForPhoneToAuthorizeSession']);
    Route::post('auth/sign-up', ['as' => 'Api.Auth.SignUp', 'uses' => 'Api\AuthController@SignUp']);
    Route::post('auth/sign-in', ['as' => 'Api.Auth.SignIn', 'uses' => 'Api\AuthController@SignIn']);
    Route::post('auth/sign-out', ['as' => 'Api.Auth.SignOut', 'uses' => 'Api\AuthController@SignOut']);
    Route::post('auth/reset-passowrd-by-phone', ['as' => 'Api.Auth.ResetPasswordByPhone', 'uses' => 'Api\AuthController@ResetPasswordByPhone']);

    /** 投资人 用户 项目的认证申请 */
    Route::get('auth/investor-auth', ['as' => 'Api.Auth.InvestorAuth', 'uses' => 'Api\AuthController@InvestorAuth']);
    Route::get('auth/user-info-auth', ['as' => 'Api.Auth.UserInfoAuth', 'uses' => 'Api\AuthController@UserInfoAuth']);
    Route::get('auth/project-auth/{id}', ['as' => 'Api.Auth.ProjectAuth', 'uses' => 'Api\AuthController@ProjectAuth']);

    /** 消息模块 */
    Route::get('me/get-message',['as'=>'Api.Me.GetMessage','uses'=>'Api\MeController@getMessage']);
    Route::post('create/interview',['as'=>'Api.Create.Interview','uses'=>'Api\MeController@setInterviewMessage']);

    /** 图片上传和显示接口 */
    Route::post('upload/image',['as'=>'Api.Upload.Image','uses'=>'Api\ImageController@UploadImage']);
    Route::get('photo/show/{id}',['as'=>'Api.Photo.Show','uses'=>'Api\UserController@getPhotoByUserId']);                    //用户头像
    Route::get('images/show/',['as'=>'Api.Images.Show','uses'=>'Api\ImageController@getImageUrlById']);
    Route::get('images/cardfront/show/{id}',['as'=>'Api.CardFront.Show', 'uses'=>'Api\UserController@getCardFrontByUserId']); //用户身份证正面
    Route::get('images/cardback/show/{id}',['as'=>'Api.CardBack.Show', 'uses'=>'Api\UserController@getCardBackByUserId']);    //用户身份证背面
    Route::get('images/callcard/show/{id}',['as'=>'Api.CallCard.Show', 'uses'=>'Api\UserController@getCallCardByUserId']);    //用户名片
    Route::get('images/create-project-logo/show/{id}',['as' =>'Api.CreateProjectLogo.Show', 'uses'=>'Api\ProjectController@getProjectLogoByProjectId']);  //获取项目logo
    Route::get('images/work-project-logo/show/{id}' , ['as' => 'Api.WorkProjectLogo.Show' , 'uses'=>'Api\UserController@getProjectLogoByLogoId']);
    Route::get('images/org-logo/show/{id}' ,['as'=>'Api.OrgLogo.Show' , 'uses'=> 'Api\UserController@getOrgLogoByOrgId']);
    Route::get('images/project-logo/show/{id}' , ['as'=>'Api.ProjectLogo.Show' , 'uses'=>'Api\ProjectController@getProjectLogoByProjectId']);
    Route::get('images/team-logo/show/{id}' , ['as'=>'Api.ProjectTeamLogo.Show' ,  'uses'=>'Api\ProjectController@getProjectTeamLogoByPhotoId']); //获取创业团队成员的logo
    Route::get('images/project-overview-image/{id}' ,['as'=>'Api.Project.getProjectOverviewImgByImgId' , 'uses'=>'Api\ProjectController@getProjectOverviewImgByImgId']);

    /** 文件上传模块 */
    Route::post('upload/file',['as'=>'Api.Upload.File','uses'=>'Api\FileController@uploadFile']);
    Route::get('file/download/{id}',['as'=>'Api.File.DownLoad','uses'=>'Api\FileController@getFileAsDownloadById']);

    /** 用户管理模块的url 定义 */
    Route::post('user/create',['as'=>'Api.User.Create','uses'=>'Api\UserController@doCreateUser']);
    Route::post('user/edit-userinfo/{id}',['as'=>'Api.User.EditUserInfo','uses'=>'Api\UserController@EditUserInfo']);
    Route::post('user/edit-user-teams/{id}' , ['as' => 'Api.UserInfo.EditUserTeams', 'uses'  =>'Api\UserController@EditUserTeams']);
    Route::post('user/edit-user-create/{id}' , ['as' => 'Api.UserCreate.EditUserCreate' , 'uses' => 'Api\UserController@EditUserCreate']);
    Route::post('user/edit-user-work/{id}' , ['as' => 'Api.UserWork.EditUserWork' , 'uses' => 'Api\UserController@editUserWork']);
    Route::post('me/edit-userinfo',['as'=>'Api.Me.EditUserInfo','uses'=>'Api\MeController@EditUserInfo']);
    Route::post('me/edit-user-create',['as'=>'Api.Me.EditUserCreate','uses'=>'Api\MeController@setUserCreate']);
    Route::post('me/edit-user-work',['as'=>'Api.Me.EditUserWork','uses'=>'Api\MeController@setUserWork']);
    Route::post('me/check-password',['as'=>'Api.Me.CheckPassword','uses'=>'Api\MeController@checkOldPassword']);
    Route::post('me/change-password',['as'=>'Api.Me.ChangePassword','uses'=>'Api\MeController@changePassword']);
    Route::post('user/del-user-create',['as'=>'Api.User.DelUserCreateById', 'uses'=>'Api\UserController@DelUserCreateById']);
    Route::post('user/del-user-work',['as'=>'Api.User.DelUserWorkById',  'uses'=>'Api\UserController@DelUserWorkById']);

    /** 编辑投资人信息接口 */
    Route::post('inv/edit-investor/{id}' , ['as' => 'Api.Investor.EditInvestor', 'uses'  =>'Api\InvestController@EditInvestor']);

    /** 通过标签搜索信息  search start */
    /** 按标签获取投资人信息 */
    Route::get('inv/get-investor-by-search' ,['as'=>'Api.Investor.getSearchMessage' , 'uses'=>'Api\InvestController@getInvestorMessageBySearch']);
    Route::get('org/get-org-by-search' ,['as'=>'Api.InvestOrg.getSearchMessage' ,  'uses'=>'Api\InvestController@getInvestOrgMessageBySearch']);
    Route::get('cre/get-creater-by-search' ,['as'=>'Api.Creater.getSearchMessage' , 'uses'=>'Api\UserController@getCreaterMessageBySearch']);

    /** search end */

    /** 编辑投资机构 */
    Route::post('inv/edit-invest-org/{id}' ,['as'=>'Api.InvestOrg.EditInvestOrg' , 'uses'=>'Api\InvestController@EditInvestOrg']);

      /** 关注模块 */
    Route::any('focus/is-focus-project/{id}' , ['as'=>'Api.Focus.IsFocusProject' , 'uses'=>'Api\FocusController@IsFocusProject']);
    Route::any('focus/is-focus-investor/{id}' , ['as'=>'Api.Focus.IsFocusInvestor' , 'uses'=>'Api\FocusController@IsFocusInvestor']);
    Route::any('focus/is-focus-invest-org/{id}' , ['as'=>'Api.Focus.IsFocusInvestOrg' , 'uses'=>'Api\FocusController@IsFocusInvestOrg']);

    /** 项目管理模块 */
    Route::post('pro/edit-project/{id}' , ['as' => 'Api.Project.EditProject', 'uses' =>  'Api\ProjectController@EditProject']);
    Route::post('pro/edit-project-milestone/{id}' , ['as' => 'Api.Project.EditProjectMilestone', 'uses' =>  'Api\ProjectController@EditProjectMilestone']);
    Route::post('pro/edit-project-news/{id}' , ['as' => 'Api.Project.EditProjectNews', 'uses' => 'Api\ProjectController@EditProjectNews']);
    Route::post('pro/set-project-team-by-userid',['as'=>'Api.Project.SetProjectTeamByUserId','uses'=>'Api\ProjectController@setProjectTeamByUserId']);
    Route::post('pro/del-project-team-by-id',['as'=>'Api.Project.DelProjectTeamById','uses'=>'Api\ProjectController@delProjectTeamById']);
    Route::get('pro/search',['as'=>'Api.Project.Search','uses'=>'Api\ProjectController@getProjectListBySearch']);
    Route::get('pro/get-fields-by-project-id/{id}',['as'=>'Api.Project.GetFields','uses'=>'Api\ProjectController@getFieldsByProjectId']);

    /** 获取更多信息 -- by ajax处理 */
    Route::get('more/get-projects-more' ,['as'=>'Api.Project.getProjectMore' , 'uses'=> 'Api\ProjectController@getProjectMore'] );
    Route::get('more/get-creater' ,['as'=>'Api.Creater.getCreaterMore' , 'uses'=>  'Api\UserController@getCreaterMore'] );
    Route::get('more/get-investor' ,['as'=>'Api.Investor.getInvestorMore' , 'uses'=> 'Api\InvestController@getInvestorMore'] );
    Route::get('more/get-invest-org' ,['as'=>'Api.Invest.getInvestOrgMore' , 'uses'=>'Api\InvestController@getInvestOrgMore'] );

    /** 提交项目操作 */
    Route::get('pro/check-is-has-project', ['as'=>'Api.Project.getProjectByUserId' , 'uses'=>'Api\ProjectController@getProjectByUserId']);
    Route::get('pro/commit-project-to-investor' , ['as'=>'Api.Project.CommitProjectToInvestor' , 'uses'=>'Api\ProjectController@CommitProjectToInvestor']);
    Route::get('pro/commit-project-to-investOrg' , ['as'=>'Api.Project.CommitProjectToInvestOrg' , 'uses'=>'Api\ProjectController@CommitProjectToInvestOrg']);

    /** 领投跟投 */
    Route::post('pro/thread-project' , ['as'=>'Api.Project.ThreadInvest' , 'uses'=>'Api\ProjectController@ThreadInvest']);
    Route::post('pro/lead-project' , ['as'=>'Api.Project.LeadInvest' , 'uses'=>'Api\ProjectController@LeadInvest']);


    /** 投资记录编辑 */
    Route::get('inv/edit-invest-log/{id}' , ['as' => 'Api.InvestLog.EditInvestLog', 'uses' => 'Api\InvestController@EditInvestLog']);
    Route::get('inv/get-invest-log' , ['as' => 'Api.InvestLog.getInvestLogByProjectId', 'uses' =>'Api\InvestController@getInvestLogByProjectId']);
    Route::get('inv/del-invest-log' , ['as' => 'Api.InvestLog.delInvestLogById', 'uses' =>'Api\InvestController@delInvestLogById']);


    /** 标签模块 */
    Route::post('tags/add-tags' , ['as' => 'Api.Tags.AddTags' , 'uses' => 'Api\TagsController@AddTags']);
    Route::post('tags/delete-tags/{id}' , ['as' => 'Api.Tags.DeleteTags' , 'uses' => 'Api\TagsController@DeleteTags']);



    /*********************************************** 后台管理模块 *****************************************/
    /** 登录 */
    Route::post('admin/signIn' , ['as'=>'Api.Admin.SignIn', 'uses'=>'Api\AdminController@SignIn']);

    /** 创业者模块 */
    Route::post('admin/edit-userInfo/{id}' ,['as'=>"Api.Admin.editUserInfoByAdmin" , 'uses'=>'Api\AdminController@editUserInfoByAdmin']);
    Route::get('admin/del-userInfo/{id}' ,['as'=>"Api.Admin.delUserInfoByAdmin" , 'uses'=>'Api\AdminController@delUserInfoByAdmin']);

    /** 投资人模块 */
    Route::post('admin/edit-investor' ,['as'=>"Api.Admin.editInvestorByAdmin" , 'uses'=>'Api\AdminController@editInvestorByAdmin']);
    Route::get('admin/del-investor/{id}' ,['as'=>"Api.Admin.delInvestorByAdmin" , 'uses'=>'Api\AdminController@delInvestorByAdmin']);
    Route::get('admin/del-investor-field' ,['as'=>'Api.Admin.Users.delInvestorField' , 'uses'=>'Api\AdminController@delInvestorField']);
    Route::get('admin/del-investor-phase' ,['as'=>'Api.Admin.Users.delInvestorPhase' , 'uses'=>'Api\AdminController@delInvestorPhase']);

    /** 投资机构模块 */
    Route::get('admin/search-org-id/{name}' , ['as'=>'Api.Admin.searchInvestOrgByOrgName' , 'uses'=>'Api\AdminController@searchInvestOrgByOrgName']);
    Route::get('admin/del-org' , ['as'=>'Api.Admin.DelInvestOrgById' , 'uses'=>'Api\AdminController@delInvestOrgById']); //删除投资机构

    /** 管理员模块 */
    Route::post('admin/edit-admin/{id}' , ['as'=>'Api.Admin.EditAdminById' , 'uses'=>'Api\AdminController@editAdminById']);
    Route::get('admin/get-admin' , ['as'=>'Api.Admin.GetAdminById' , 'uses'=>'Api\AdminController@getAdminById']);
    Route::get('admin/del-admin' , ['as'=>'Api.Admin.DelAdminById' , 'uses'=>'Api\AdminController@delAdminById']);

    /** 项目模块 */
    Route::get('admin/del-project' , ['as'=>'Api.Admin.DeleteProjectById' , 'uses'=>'Api\AdminController@deleteProjectById']);
    Route::post('admin/del-project-overview-image',['as'=>'Api.Admin.delOverviewImage' ,  'uses'=>'Api\AdminController@delOverviewImageById']);

    /** 项目 - 团队信息  */
    Route::get('pro/del-project-team' , ['as'=>'Api.Admin.delTeamByProIdAndTeamId' , 'uses'=>'Api\AdminController@delTeamByProIdAndTeamId']);   //删除项目团队信息通过项目标识 和 团队标识
    Route::get('pro/get-project-team-by-team-id' , ['as'=>'Api.Admin.getTeamByTeamId' , 'uses'=>'Api\AdminController@getTeamByTeamId']);   //获取团队信息
    Route::get('pro/get-project-team-by-pro-id' , ['as'=>'Api.Admin.getTeamByProId' , 'uses'=>'Api\AdminController@getTeamByProId']);   //获取团队信息

    /** 项目 - 里程碑 **/
    Route::get('pro/get-milestone-by-pro-id' , ['as'=>'Api.Admin.getMilestoneByProId' , 'uses' => 'Api\AdminController@getMilestoneByProId']); //通过项目标识获取里程碑信息


    /** 审核模块 */

    /** 审核项目 */
    Route::get('admin/check-project-over/{auth}' , ['as'=>'Api.Admin.CheckOverProject' , 'uses'=>'Api\AdminController@checkProjectByIdByAdmin']);
    Route::get('admin/check-project-out/{auth}' , ['as'=>'Api.Admin.CheckOutProject' , 'uses'=>'Api\AdminController@checkProjectByIdByAdmin']);
    Route::post('admin/del-project-field' , ['as'=>'Api.Admin.delProjectField' ,'uses'=>'Api\AdminController@delProjectField']);

    /** 审核投资人 */
    Route::get('admin/check-investor-over/{auth}' , ['as'=>'Api.Admin.CheckOverInvestor' , 'uses'=>'Api\AdminController@checkInvestorByIdByAdmin']);
    Route::get('admin/check-investor-out/{auth}' , ['as'=>'Api.Admin.CheckOutInvestor' , 'uses'=>'Api\AdminController@checkInvestorByIdByAdmin']);

    /** 审核投资机构 */
    Route::get('admin/check-invest-org-over/{auth}' , ['as'=>'Api.Admin.CheckOverInvestOrg' ,'uses'=>'Api\AdminController@checkInvestOrgByIdByAdmin']);
    Route::get('admin/check-invest-org-out/{auth}' , ['as'=>'Api.Admin.CheckOutInvestOrg' ,'uses'=>'Api\AdminController@checkInvestOrgByIdByAdmin']);

    /** 里程碑 */
    Route::get('admin/del-milestone' , ['as'=>'Api.Admin.DeleteMilestone' , 'uses'=>'Api\AdminController@DeleteMilestoneById']);



    /**************************************************   end   **********************************************************/
});


Route::group(['prefix' => 'home'],function() {
    Route::any('login',['as'=>'Home.Auth.loginShow','uses'=>'HomeController@loginShow']);
    Route::any('register',['as'=>'Home.Auth.registerShow','uses'=>'HomeController@registerShow']);
    Route::any('me/investor',['as'=>'Home.Me.investor','uses'=>'HomeController@investor']);
    Route::any('loginOut',['as'=>'Home.Auth.signOut','uses'=>'HomeController@signOut']);
   
    /** 项目显示模块 */
    Route::get('pro/show-project-detail/{id}', ['as' => 'Home.Project.getProjectById', 'uses' => 'HomeController@getProjectById']);
    Route::get('pro/show-projects' , ['as' => 'Home.Project.getProjectPage' , 'uses' =>  'HomeController@getProjectPage']);
    Route::get('pro/show-15finance' , ['as' => 'Home.Project.get15FinancePage' , 'uses' => 'HomeController@get15FinancePage']);
    Route::any('pro/create-project' , ['as' => 'Home.Project.showCreateProject'  , 'uses' => 'HomeController@showCreateProject']);
    Route::any('pro/create-project-need' , ['as' => 'Home.Project.showCreateProjectNeed'  , 'uses' => 'HomeController@showCreateProjectNeed']);
    Route::get('pro/search/',['as'=>'Home.Project.Search','uses'=>'HomeController@showProjectBySearch']);

    /** 投资人信息模块 */
    Route::get('inv/show-investor-detail/{id}' , ['as' => 'Home.Investor.getInvestorByUserId' , 'uses' =>'HomeController@getInvestorByUserId']);
    Route::get('inv/show-investor' , ['as' => 'Home.Investor.getInvestorPage' , 'uses' =>  'HomeController@getInvestorPage']);
    Route::get('inv/show-investor-project',['as'=>'Home.Investor.getInvestorInvProject','uses'=>'HomeController@getInvestorInvProjectMoreByUserId']);

    /** 投资机构信息模块 */
    Route::get('org/show-investorg',['as'=>'Home.InvestOrg.getInvestOrg','uses'=>'HomeController@getInvestOrg']);
    Route::get('org/show-investorg-details/{id}',['as'=>'Home.InvestOrg.getInvestOrgDetails','uses'=>'HomeController@getInvestOrgDetails']);
    Route::get('inv/show-investorg-project',['as'=>'Home.Investor.getInvestorgInvProject','uses'=>'HomeController@getOrgInvProjectMoreByUserId']);

    /** 创业者信息模块 */
    Route::get('cre/show-creater',['as'=>'Home.Creater.getCreater','uses' => 'HomeController@enterpriser']);
    Route::get('cre/show-creater-details/{id}',['as'=>'Home.Creater.getCreaterDetails', 'uses'=>'HomeController@enterpriserDetails']);

    /** 用户中心模块 */
    Route::get('user/user-center',['as'=>'Home.User.showUserCenter','uses'=>'HomeController@userCenter']);
    Route::get('user/project-base/{id}',['as'=>'Home.User.showProjectBase','uses'=>'HomeController@showProjectBase']);
    Route::get('user/project-info/{id}',['as'=>'Home.User.showProjectInfo','uses'=>'HomeController@showProjectInfo']);

    /** 15天快速融资 */
    Route::get('15fin/show-15-finance' ,['as'=>'Home.15Finance.Show15Finance' ,'uses'=>'HomeController@Show15Finance']);

});


Route::group(['prefix' => 'admin'],function() {
    /** 进入登录页面 */
    Route::get('signIn' , ['as'=>'Admin.SignIn' , 'uses'=>'HomeController@showAdminSignIn']);

    /** 后台默认页面 */
    Route::get('index' ,['as'=>'Admin' , 'uses'=>'AdminController@getCreaterList']);

    /** 用户管理模块 */
    Route::get('users/show-creater' ,['as'=>'Admin.Users.getCreaterList' , 'uses'=>'AdminController@getCreaterList']);
    Route::get('users/show-investor' ,['as'=>'Admin.Users.getInvestorList' , 'uses'=>'AdminController@getInvestorList']);
    Route::get('users/show-invest-org' ,['as'=>'Admin.Users.getInvestOrgList' , 'uses'=>'AdminController@getInvestOrgList']);
    Route::get('users/show-create-team' ,['as'=>'Admin.Users.getCreateTeamList' , 'uses'=>'AdminController@getCreateTeamList']);
    Route::get('users/show-manager' ,['as'=>'Admin.Users.getManagerList' , 'uses'=>'AdminController@getManagerList']);
    Route::get('users/show-edit-creater/{id}' ,['as'=>'Admin.Users.editCreaterPage' , 'uses'=>'AdminController@editCreaterPage']);
    Route::get('users/show-edit-creater/{id}' ,['as'=>'Admin.Users.editCreaterPage' , 'uses'=>'AdminController@editCreaterPage']);
    Route::get('users/show-edit-investor/{id}' ,['as'=>'Admin.Users.editInvestorPage' ,'uses'=>'AdminController@editInvestorPage']);
    Route::get('users/show-edit-invest-org/{id}' ,['as'=>'Admin.Users.editInvestOrgPage' , 'uses'=>'AdminController@editInvestOrgPage']);

    /** 项目管理模块 */
    Route::get('pro/show-projects' , ['as'=>'Admin.Projects.getProjectsList' , 'uses'=>'AdminController@getProjectsList']);
    Route::get('pro/show-edit-project/{id}' , ['as'=>'Admin.Projects.editProjectByProjectId' ,'uses'=>'AdminController@editProjectByProjectId']);
    Route::get('pro/show-apply-finance-projects' , ['as'=>'Admin.Projects.getApplyFinanceProjectList' ,'uses'=>'AdminController@getApplyFinanceProjectList']);
    Route::get('pro/show-success-finance-projects' , ['as'=>'Admin.Projects.getSuccessFinanceProjectList' , 'uses'=>'AdminController@getSuccessFinanceProjectList']);

    /** 审核管理模块 */
    Route::get('check/show-check-investors' , ['as'=>'Admin.Check.getCheckInvestorList' , 'uses'=>'AdminController@getCheckInvestorList']);
    Route::get('check/show-check-invest-org' , ['as'=>'Admin.Check.getCheckInvestOrgList' ,'uses'=>'AdminController@getCheckInvestOrgList']);
    Route::get('check/show-check-projects' , ['as'=>'Admin.Check.getCheckProjectsList' ,'uses'=>'AdminController@getCheckProjectsList']);

    /** 消息管理模块 */

    /** 活动管理模块 */

    /** 系统管理模块 */


});

Route::any('fields','InstallController@setFields');
Route::any('phase','InstallController@setPhase');
Route::any('dist','InstallController@setDistrict');
Route::any('role','InstallController@setRoles');
Route::any('overview' , 'Api\ProjectController@getOverviewImg');
Route::get('test' ,function(){
    $field = \Illuminate\Support\Facades\Input::get('field');

    $a = null;
    if($field) {
        $a = \App\Fields::find($field);
        $b = $a->project_x_fields()->getParent();
    }

    return $b;
});

Route::any('demo' , ['as'=>'editTags' ,'uses'=>'Api\TagsController@EditTags']);

